test: add unit tests for core helpers and wire tests into CI - #127
Merged
Conversation
Cover normalizeUrl, provider guessing/resolution, tier partitioning, GitHub GraphQL query builders, the GitHub sponsors fetcher, and the SVG composer. Run tests in CI via the shared sxzz workflow and switch the default test script to non-watch mode.
antfubot
force-pushed
the
grumpy-laws-cross
branch
from
August 3, 2026 00:32
513eda5 to
e2dd178
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Introduces a baseline of unit tests for the library's pure, dependency-free helpers, plus one mocked-network test, and makes CI actually run the test suite.
Tests added (46 assertions across 6 files)
normalizeUrl— protocol defaulting and normalizationguessProviders/resolveProviders/ProvidersMap— provider detection, dedupe, and unknown-name errorspartitionTiers— tier bucketing, the "exactly one zero-dollar tier" invariant, past-sponsor filtering, and within-tier orderingmakeQuery/makeSponsoringQuery/makeSponsoringTotalAmountQuery— GraphQL string buildersfetchGitHubSponsors— argument validation, pagination, response mapping, and error handling (via a mockedofetch)SvgComposerandgenSvgImage— SVG assembly and deterministic clip idsTooling
vitest.config.tsexcluding theexample/workspace from the runtestscript now runsvitest run(non-watch) so it terminates in CI; addtest:watchfor local watch modelint.ymlwithci.ymlusing the sharedsxzz/workflowsunit-test workflow, which runs lint + build + typecheck + test (superseding the old lint-only workflow)Why
The repo had a single existing test file and CI never ran tests. This establishes a fast, mock-light safety net over the most testable logic and ensures tests gate PRs.
This PR was created with the help of an agent.